#ifndef _BRTMP_UTIL_H
#define _BRTMP_UTIL_H

#include <stdlib.h>

#ifdef __cplusplus
extern "C" {
#endif

#define MAX(a, b) ((a) > (b) ? (a) : (b)) 
#define MIN(a, b) ((a) > (b) ? (b) : (a)) 

void (*signal_intr(int signo, void (*sighandler)(int)))(int);
void hexdump(const void *input, const size_t length);
void err_exit(const char *format, ...);
ssize_t read_n(const int fd, void *buff, const size_t buff_len);
ssize_t write_n(const int fd, const void *buff, const size_t buff_len);

int put_string(const int fd, const char *buff, const size_t max_len);
int get_string(const int fd, char *buff, const size_t max_len);

#ifdef __cplusplus
}
#endif

#endif
